using RuoVea.OmiUI;

namespace RuoVea.OmiUI.Test._6._0
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var builder = WebApplication.CreateBuilder(args);

            // Add services to the container.
            builder.Services.AddControllersWithViews();
            builder.Services.AddControllers(); // 添加API控制器支持

            var app = builder.Build();

            // Configure the HTTP request pipeline.
            if (!app.Environment.IsDevelopment())
            {
                app.UseExceptionHandler("/Home/Error");
            }
            
            // 启用静态文件服务
            app.UseStaticFiles();
            
            // 使用RuoVea.OmiUI静态资源
            app.UseOmiUIStaticAssets();

            app.UseRouting();
            app.UseAuthorization();
            // 配置API控制器路由
            app.MapControllers();

            // 配置MVC路由
            app.MapControllerRoute(
                name: "default",
                pattern: "{controller=Home}/{action=Index}/{id?}");

            app.Run();
        }
    }
}